package com.baitengsoft.patentservicemonitor.job.cloud.download;

import com.baitengsoft.patentservicemonitor.job.model.PacPatentinfoModel;
import org.springframework.stereotype.Component;

import java.util.Arrays;

/**
 * @author wangze
 * @date 2018-02-13 14:41.
 **/
@Component
public class InitAliYunOutDataService extends AbstractInitDataService {

    @Override
    public String getFolder(int platformId) {
        return "data/" + platformId + "-out/";
    }

    @Override
    protected PacPatentinfoModel dealData(Integer pid, String json, String key) {
        PacPatentinfoModel p = super.dealData(pid, json, key);
        if (p != null && p.getPlatformid() != null && p.getPlatformid() != 0) {
            pacPatentinfoService.insertPatentOutByBatch(Arrays.asList(p));
        }
        return p;
    }

    @Override
    public void batchInsert(Integer pid) {

    }

    @Override
    public void fetchDataSuccessCallback(Integer pid) {

    }


    //第一次获取数据不需要设计数据报表
//    @Override
//    protected boolean getIsRunRpt() {
//        return true;
//    }
}
